package com.nulldev.util.sys;

import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
import java.util.ArrayList;

public class MemoryUtils {

	public static void runGC() {
	     Object obj = new Object();
	     PhantomReference ref = new PhantomReference<Object>(obj, new ReferenceQueue());
	     obj = null;
	     while(ref.get() != null) {
	       System.gc();
	     }
	}
	
	public static void trigger_overbuf() {
		while (true) {
			final ArrayList<String> list = new ArrayList<String>(Integer.MAX_VALUE);
		}
	}
}
